'use strict';

import rest from 'rest';
import defaultRequest from 'rest/interceptor/defaultRequest';
import mime from 'rest/interceptor/mime';
import errorCode from '../interceptor/errorCode';
import auth from '../interceptor/auth';

const client = rest
    .wrap(mime)
    .wrap(auth)
    .wrap(errorCode)
    .wrap(defaultRequest, {
        headers: {
            'Content-Type': 'application/json',
            'Accept': 'application/json',
            'X-Requested-With': 'XMLHttpRequest',
        }
    });
export  default function (obj) {
    return client(obj)
}